/*******************************************************************************
 * Copyright (c) 2008 Sylvain Sicard.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Sylvain Sicard - initial API and implementation
 ******************************************************************************/
package fr.jade.console.cmd;

import java.util.Map;

import fr.jade.console.core.AbstractCommand;
import fr.jade.console.core.Command;
import fr.jade.console.core.Environment;

public class PrintEnv extends AbstractCommand  implements Command {
  
  public String getDescription(){
    return "print the jvm env vars";
  }
  
  public String getHelp() {
    return "printjavaenv";
  }
  
  public String getName() {
    return "printjavaenv";
  }
  
  public Object execute(String[] args, Environment env) throws Throwable {

    System.out.println("Environment");
    for(Map.Entry<String, String> e : System.getenv().entrySet()){
      System.out.println(e.getKey()+" : "+e.getValue());
    }
    System.out.println("Properties");
    for(Object key : System.getProperties().keySet()){
      String k = (String)key;
      System.out.println(k+" : "+System.getProperty(k));
    }
    return null;
  }

}
